<template>
	<view class="Menu">
		<!-- 导航条 :style="{ height: $wanlshop.wanlsys().height + 'px' }"-->
		<view class="cu-custom">
			<view class="cu-bar fixed" style="background: #fff;"
				:style="{height: $wanlshop.wanlsys().height + 'px',paddingTop: $wanlshop.wanlsys().top + 'px',}">
				<view class="action">
					<!-- <text class="wlIcon-fanhui1" style="margin-left: 0" @tap="$wanlshop.back(1)"></text> -->
				</view>
				<view class="content" :style="{ top: $wanlshop.wanlsys().top + 'px' }">
					<!-- 我的 -->{{$t('myotc.page.title')}}
				</view>
				<view class="action">
					<text class="wlIcon-gengduo" @tap="showModal('share')"></text>
				</view>
			</view>
		</view>
		<view
			style="position: fixed;height: 100%; overflow: auto;  width: auto; top: 0; left: 0; bottom: 0; right: 0; padding-bottom: 220rpx;"
			:style="{top: $wanlshop.wanlsys().height + 'px',}">
			<view class="Myt">
				<view class="money">
					<p><!-- 总资产预估 -->{{$t('myotc.tips.property')}}</p>
					<h3>{{usdt_money}} USD</h3>
				</view>
				<view class="vieList">
					<view class="extract">
						<view class="wz" @tap="$wanlshop.auth('/pages/newPage/recharge')">
							{{$t('myotc.but.recharge')}}<!-- 充值 -->
						</view>
					</view>
					<view class="extract" style="display: flex;justify-content: center;">
						<view class="wz" @tap="$wanlshop.auth('/pages/newPage/transfer')">
							{{$t('myotc.but.transfer')}}<!-- 转账 -->
						</view>
					</view>
					<view class="extract" style="display: flex;justify-content: flex-end;">
						<view class="wz" @tap="$wanlshop.auth('/pages/newPage/extract')">
							{{$t('myotc.but.extract')}}<!-- 提取 -->
						</view>
					</view>
					<view class="extract" style="display: flex;justify-content: flex-end;">
						<view class="wz" @tap="$wanlshop.auth('/pages/newPage/convert')">
							闪兑
						</view>
					</view>
				</view>
			</view>
			<view class="cellList" v-for="(item,index) in list" :key="index" @click="handleDetail(index)">
				<view class="name">
					<image :src="'/static/images/otc/Frame'+index+'.png'" class="icon"></image>
					{{ item.name }}
				</view>
				<view class="money">
					<view class="price">
						{{item.integral||0}}<span v-if="item.name!=='AP'">~{{'$'+item.money||0}}</span>
					</view>
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
			<view class="cellList">
				<view class="name">
					销毁总量
				</view>
				<view class="money">
					<view class="price">
						{{yld_xh_money||0}}
					</view>
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
			<!-- <view class="cellList" @tap="$wanlshop.auth('/pages/newPage/stock4')">
				<view class="name">
					冻结YLD
				</view>
				<view class="money">
					<view class="price">
						${{ap_yld}}
					</view>
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view> -->
			<view class="cellList" @tap="$wanlshop.auth('/pages/manage/index')">
				<view class="name">
					理财专区
				</view>
				<view class="money">
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
			<view class="cellList" @tap="$wanlshop.auth('/pages/newPage/exchange')">
				<view class="name">
					抽奖券兑换
				</view>
				<view class="money">
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
			<view class="cellList" @tap="$wanlshop.auth('/pages/newPage/paypwd')">
				<view class="name">
					支付密码设置
				</view>
				<view class="money">
					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
			<view class="cellList" @click="clearCache">
				<view class="name">
					<text>{{$t('setting-清除缓存')}}</text>
				</view>
				<view class="money">

					<u-icon name="arrow-right" color="#666" size="12"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {

		data() {
			return {
				list: [],
				usdt_money: "",
				user: {},
				yld_xh_money: '',
				ap_yld: '',
			};
		},
		onShow() {
			this.transferInfo()
			this.user = uni.getStorageSync("wanlshop:user")
		},

		methods: {
			//转账信息
			transferInfo() {
				uni.request({
					url: "/wanlshop/otc/my/integralExchangeAmount",
					method: 'POST',
					success: (res) => {
						if (res.res.code == 1) {
							this.list = res.res.data.list
							this.list.splice(1, 1)
							this.usdt_money = res.res.data.total_price
							this.yld_xh_money = res.res.data.yld_xh_money
							this.ap_yld = res.res.data.suo_yld

						}
					},
				});
			},
			handleDetail(val) {
				if (val == 0) {
					this.$wanlshop.auth("/pages/newPage/stock1");
				} else if (val == 1) {
					this.$wanlshop.auth("/pages/newPage/stock2");
				} else if (val == 2) {
					this.$wanlshop.auth("/pages/newPage/stock3");
				}
			},

			clearCache() {
				let that = this
				uni.clearStorage({
					success: function() {
						uni.showToast({
							title: "缓存清理完成",
							icon: 'none'

						})
						setTimeout(function() {
							that.$wanlshop.auth("/pages/user/auth/auth");
						}, 1000)

					},
					fail: function() {
						console.log('清理缓存失败');
					}
				});
			}
		}
	};
</script>

<style lang="scss">
	.Menu {
		.Myt {
			margin: 24rpx;
			padding: 52rpx 30rpx 44rpx 30rpx;
			border-radius: 20rpx;
			background: #000;
			color: #fff;

			.money {
				p {
					font-size: 28rpx;
					color: #FFFFFF;
				}

				h3 {
					font-size: 40rpx;
					color: #FFFFFF;
					font-weight: 600;
					margin: 16rpx 0 40rpx 0;
				}
			}

			.vieList {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.extract {
					width: 22%;
					background: #D58712;
					border-radius: 4rpx;
					display: initial !important;

					.wz {
						height: 56rpx;
						line-height: 56rpx;
						text-align: center;
						color: #fff;

					}
				}
			}
		}

		.cellList {
			margin: 24rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 40rpx 30rpx 40rpx 30rpx;
			background: #fff;
			border-radius: 16rpx;
			font-size: 28rpx;
			color: #333333;

			.name {
				display: flex;
				align-items: center;

				.icon {
					width: 32rpx;
					height: 32rpx;
					margin-right: 10rpx;
				}
			}

			.money {
				display: flex;
				align-items: center;
				color: #666666;

				.price {
					text-align: right;

					span {
						display: block;
					}
				}

				/deep/.u-icon {
					margin-left: 30rpx;
				}
			}
		}
	}
</style>